package com.eddy.liveline.requirement.controller;


import com.eddy.liveline.core.cache.redis.dbcache.test.TestCacheServiceImpl;
import com.eddy.liveline.core.spring.mybatis.pagehelper.Table;
import com.eddy.liveline.requirement.pojo.Requirement;
import com.eddy.liveline.requirement.pojo.RequirementTableQuery;
import com.eddy.liveline.requirement.service.RequirementService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/requirement")
public class RequirementController {

    @Resource
    private RequirementService requirementService;

    @ResponseBody
    @RequestMapping(value = {"/list"})
    public Table<Requirement> list(RequirementTableQuery requirementTableQuery) {
        return requirementService.query(requirementTableQuery);
    }


    @Resource
    private TestCacheServiceImpl testCacheService;

    /**
     * 测试 ，使用redis 做缓存的测试
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping(value = {"/getById/{id}"})
    public Requirement getById(@PathVariable("id")String id) {
        return testCacheService.getById(id);
    }





}
